﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// Simple Service Administration Tool for WinNT based systems.
// Copyright © 2010 - Silvan Gehrig
// 
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
// 
// Author:
//  Silvan Gehrig
//
// ---------------------------------------------------------------------
#endregion

#region Usings

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

using SSATool.DL.Common;

#endregion

namespace SSATool.DL.Common.Dto
{
    /// <summary>
    /// Specifies an implementation for the data provided by the underlying service controller.
    /// </summary>
    /// <remarks>This class represents a POCO for the data transfer.</remarks>
    [DataContract]
    public class ServiceController
    {
        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        /// <summary>
        /// Gets a value indicating whether the service can be paused and resumed.
        /// </summary>
        /// <returns>
        /// Returns true if the service can be paused; otherwise, false.
        /// </returns>
        [DataMember]
        public bool CanPauseAndContinue { get; set; }

        /// <summary>
        /// Gets a value indicating whether the service should be notified when the system
        /// is shutting down.
        /// </summary>
        /// <returns>
        /// Returns true if the service should be notified when the system is shutting down;
        /// otherwise, false.
        /// </returns>
        [DataMember]
        public bool CanShutdown { get; set; }

        /// <summary>
        /// Gets a value indicating whether the service can be stopped after it has started.
        /// </summary>
        /// <returns>
        /// Returns true if the service can be stopped; otherwise, false.
        /// </returns>
        [DataMember]
        public bool CanStop { get; set; }

        /// <summary>
        /// Gets or sets a friendly name for the service.
        /// </summary>
        [DataMember]
        public string DisplayName { get; set; }

        /// <summary>
        /// Gets or sets the name of the computer on which this service resides.
        /// </summary>
        [DataMember]
        public string MachineName { get; set; }

        /// <summary>
        /// Gets or sets the name that uniquely identifies the service that this instance references.
        /// </summary>
        [DataMember]
        public string ServiceName { get; set; }

        /// <summary>
        /// Gets the set of unqiue service names that depends on the service associated with this
        /// instance.
        /// </summary>
        [DataMember]
        public IList<string> DependentServices { get; set; }

        /// <summary>
        /// The set of unique service names that this service depends on.
        /// </summary>
        [DataMember]
        public IList<string> ServicesDependedOn { get; set; }

        /// <summary>
        /// Gets/sets the status of the service that is referenced by this instance. If you change
        /// the value of this property and send it back to the server, the service will be
        /// changed to the new state.
        /// </summary>
        /// <returns>
        /// One of the ServiceControllerStatus values that indicates whether the
        /// service is running, stopped, or paused, or whether a start, stop,
        /// pause, or continue command is pending.
        /// </returns>
        [DataMember]
        public ServiceControllerStatus Status { get; set; }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceController"/> class.
        /// This constructer is needed by the WCF serialization facilities.
        /// </summary>
        public ServiceController()
        {
        }

        #endregion

        #region Events
        //--------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------

        #endregion
    }
}
